package com.zi.experttalk.experttalk.View;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.*;
import com.zi.experttalk.experttalk.R;

/**
 * Created by lenovo on 2014/12/10.
 */
public class UserActivity extends Activity {
    private EditText user_userEmail_EditText;
    private EditText user_userPassWord_EditText;
    private Button user_login_Buttton;
    private Button user_registe_Button;
    private LinearLayout login_layout;
    private LinearLayout onLine_layout;
    private ImageView user_imageView;
    private TextView userName_TextView;
    private TextView myNtegral;
    private LinearLayout changePassWord;
    private LinearLayout myPrivilege;
    private LinearLayout exitLogin;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.user);
        user_userEmail_EditText = (EditText) findViewById(R.id.user_userEmail_EditText);
        user_userPassWord_EditText = (EditText) findViewById(R.id.user_userPassWord_EditText);
        user_login_Buttton = (Button) findViewById(R.id.user_login_Buttton);
        user_registe_Button = (Button) findViewById(R.id.user_registe_Button);
        login_layout = (LinearLayout) findViewById(R.id.login_layout);
        onLine_layout = (LinearLayout) findViewById(R.id.onLine_layout);
        user_imageView = (ImageView) findViewById(R.id.user_imageView);
        userName_TextView = (TextView) findViewById(R.id.userName_TextView);
        myNtegral = (TextView) findViewById(R.id.myNtegral);
        changePassWord = (LinearLayout) findViewById(R.id.changePassWord);
        myPrivilege = (LinearLayout) findViewById(R.id.myPrivilege);
        exitLogin = (LinearLayout) findViewById(R.id.exitLogin);

        user_registe_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(UserActivity.this,RegisterActivity.class);
                startActivityForResult(intent,3);


            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (requestCode) {
            case 3:
                if (resultCode == RESULT_OK) {
                    String userName = data.getStringExtra("back");
                    login_layout.setVisibility(View.GONE);
                    onLine_layout.setVisibility(View.VISIBLE);
                    userName_TextView.setText(userName);
//                    修改密码点击事件
                    changePassWord.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {

                        }
                    });

//                    我的积分点击事件
                    myPrivilege.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {

                        }
                    });

//                    退出登录点击事件
                    exitLogin.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {

                        }
                    });

                }
                break;
        }
    }
}
